Automatic Routing Method for SE and Electronic Device

ABSTRACT

An electronic device including a plurality of SEs, wherein each of the plurality of SEs carries at least one NFC application, and configured to store first identifiers and SE location information indicating an SE that carries a corresponding NFC application of a plurality of NFC applications, receive a transaction instruction, search, in response to that the transaction instruction carries a first identifier, the stored SE location information for SE location information corresponding to the first identifier carried in the transaction instruction, determine a first target SE from at least two SEs based on the SE location information, and send the transaction instruction to the first target SE.

This application claims priority to Chinese Patent Application No.201910345528.5, filed with the China National Intellectual PropertyAdministration on Apr. 26, 2019 and entitled “AUTOMATIC ROUTING METHODFOR SE AND ELECTRONIC DEVICE”, and claims priority to Chinese PatentApplication No. 201910426179.X, filed with the China NationalIntellectual Property Administration on May 21, 2019 and entitled“AUTOMATIC ROUTING METHOD FOR SE AND ELECTRONIC DEVICE”, which areincorporated herein by reference in their entireties.

TECHNICAL FIELD

Embodiments of this application relate to the field of near fieldcommunication (Near Field Communication, NFC) technologies, and inparticular, to an automatic routing method for a secure element(Security Element, SE) and an electronic device.

BACKGROUND

NFC is a near field communication technology, and allows non-contactpoint-to-point data transmission between devices. NFC has relativelyhigh security, and is increasingly popular and accepted by the public inrecent years. An electronic device having an NFC function developsparticularly rapidly. The electronic device having the NFC function maywork in three modes: a card reader mode, a card emulation mode, and apoint-to-point mode. The card emulation mode is most frequently used.The electronic device may be emulated as a non-contact integratedcircuit (Integrated Circuit. IC) card, and a user may interact with acard reader by holding the electronic device, to complete an operationsuch as swiping a bank card, swiping a bus card, or swiping a socialsecurity card. This brings great convenience to life.

Before the electronic device is emulated as the non-contact IC card tointeract with the card reader, the electronic device needs to download acorresponding NFC application to a secure element (Security Element, SE)of the electronic device. The SE may provide a secure executionenvironment for running the NFC application, and provide a securestorage environment for sensitive data of the NFC application.

Currently, one electronic device may include a plurality of SEs.Usually, a mobile operator tends to use an SE in a form of a subscriberidentity module (subscriber identification module, SIM) card, anelectronic device manufacturer tends to use an eSE, and an applicationmanufacturer tends to use host-based card emulation (host cardemulation, HCE). Usually, an NFC controller of the electronic device maydetermine, by using a method in which a route points to an SE, an SEthat undertakes a current NFC transaction.

One SE may simultaneously carry a plurality of NFC applications. Whenthe NFC applications carried in the SE are activated, the electronicdevice may be emulated as a corresponding non-contact IC card tointeract with a card reader. The NFC applications may be manuallyactivated by the user, or may be automatically activated by theelectronic device. Specifically, after receiving a transactioninstruction sent by the card reader, the electronic device maydetermine, based on an application identifier (Application Identifier,AID) carried in the transaction instruction, an NFC application that iscarried in the SE and that is to be accessed by the transactioninstruction.

Usually, only an SE to which a route of the NFC controller points canundertake an NFC transaction, that is, process the transactioninstruction. When the transaction instruction needs to access an NFCapplication carried in another SE, the transaction cannot be performed.The another SE is not the SE to which the route of the NFC controllerpoints. Therefore, when the electronic device includes a plurality ofSEs, how to make the route of the NFC controller point to an SE in whichan NFC application to be accessed by the transaction instruction islocated is an urgent problem to be resolved.

SUMMARY

Embodiments of this application provide an automatic routing method foran SE and an electronic device. Therefore, even if the electronic deviceincludes a plurality of SEs, the electronic device can be automaticallyrouted to an SE in which an NFC application to be accessed by atransaction instruction is located.

According to a first aspect, an embodiment of this application providesan electronic device. The electronic device includes an NFC controllerand at least two SEs, and each of the at least two SEs carries at leastone NFC application. The NFC controller stores first identifiers and SElocation information of a plurality of NFC applications, and the SElocation information indicates an SE that carries a corresponding NFCapplication. The NFC controller can receive a transaction instruction.The NFC controller may search, in response to a fact that thetransaction instruction carries a first identifier, the SE locationinformation stored in the NFC control for SE location informationcorresponding to the first identifier carried in the transactioninstruction. The NFC controller determines a first target SE from the atleast two SEs based on the found SE location information, and sends thetransaction instruction to the first target SE.

In this embodiment of this application, the NFC controller may store thefirst identifiers and the SE location information of the plurality ofNFC applications. Therefore, after receiving the transaction instructionthat carries the first identifier, the electronic device may determine,based on the first identifier carried in the transaction instruction, SElocation information of an NFC application to be accessed by thetransaction instruction. To be specific, the electronic device maydetermine an SE in which the NFC application to be accessed by thetransaction instruction is carried.

In this embodiment of this application, the NFC controller can beautomatically routed, based on the first identifier carried in thetransaction instruction, to the SE in which the NFC application to beaccessed by the transaction instruction is located.

With reference to the first aspect, in a possible design manner, thefirst target SE may receive the transaction instruction, and determine,based on the first identifier carried in the transaction instruction, afirst target NFC application from NFC applications carried in the firsttarget SE. The first target SE runs the first target NFC application, toexecute the transaction instruction.

To be specific, the target SE may send, based on the first identifiercarried in the transaction instruction, the transaction instruction tothe NFC application to be accessed by the transaction instruction, andthe NFC application to be accessed by the transaction instructionexecutes the transaction instruction, to complete the transaction.

With reference to the first aspect, in another possible design manner,the first identifier may be an AID. Certainly, the first identifierincludes but is not limited to the AID.

With reference to the first aspect, m another possible design manner, anNFC management application of the first target NFC application carries afirst identifier of the first target NFC application and SE locationinformation of the first target NFC application. The SE locationinformation of the first target NFC application indicates the firsttarget SE that carries the first target NFC application. The NFCmanagement application is configured to manage one or more NFCapplications. The NFC controller is configured to receive the firstidentifier of the first target NFC application and the SE locationinformation of the first target NFC application that are transmittedwhen the NFC management application of the first target NFC applicationregisters with a default payment application of the electronic device.

During installation, the NFC management application of the first targetNFC application registers with the default payment application of theelectronic device. The NFC controller is further configured to store thefirst identifier of the first target NFC application and the SE locationinformation of the first target NFC application.

With reference to the first aspect, in another possible design manner,that the transaction instruction is sent to the first target SE mayinclude: If the first target SE is an SE to which a route of the NFCcontroller points, the NFC controller may directly transmit the receivedtransaction instruction to the first target SE, the first target SEsends the transaction instruction to the NFC application to be accessedby the transaction instruction, and the NFC application to be accessedby the transaction instruction executes the transaction instruction, tocomplete the transaction. If the first target SE is not an SE to which aroute of the NFC controller points, the NFC controller may modify theroute to point to the first target SE, and then transmit the receivedtransaction instruction to the SE, the SE sends the transactioninstruction to the NFC application to be accessed by the transactioninstruction, and the NFC application to be accessed by the transactioninstruction executes the transaction instruction, to complete thetransaction.

It may be understood that the SE indicated by the SE locationinformation may or may not be the SE to which the route of the NFCcontroller points. After finding the SE location informationcorresponding to the first identifier, the electronic device maydetermine that the SE indicated by the SE location information is the SEto which the route of the NFC controller points. If the SE indicated bythe SE location information is the SE to which the route of the NFCcontroller points, the NFC controller may directly transmit the receivedtransaction instruction to the SE, the SE sends the transactioninstruction to the NFC application to be accessed by the transactioninstruction, and the NFC application to be accessed by the transactioninstruction executes the transaction instruction, to complete thetransaction. If the SE indicated by the SE location information is notthe SE to which the route of the NFC controller points, the NFCcontroller may modify the route to point to the SE, and then transmitthe received transaction instruction to the SE, the SE sends thetransaction instruction to the NFC application to be accessed by thetransaction instruction, and the NFC application to be accessed by thetransaction instruction executes the transaction instruction, tocomplete the transaction.

With reference to the first aspect, in another possible design manner,not all NFC applications support use of the first identifier (forexample, the AID). For example, the first identifier is the AID. Forexample, some bus cards do not support use of the AID. Therefore, thetransaction instruction received by the NFC controller of the electronicdevice does not include the first identifier. Based on this case, aprocessor of the electronic device may store one or more pieces of usescenario information, one or more pieces of SE location information, andone or more second identifiers of one or more non-standard NFCapplications.

For example, the electronic device (for example, the processor of theelectronic device) may maintain a non-standard card information table.The non-standard card information table may include query information ofa non-standard NFC application installed in the electronic device. Thequery information of the non-standard NFC application may include usescenario information. SE location information, and a second identifierof the non-standard NFC application.

The non-standard NFC application does not support the AID. The secondidentifier is used to identify the non-standard NFC application, and thesecond identifier is not the first identifier (for example, the AID).The use scenario information is used to indicate scenario information ofusing a corresponding non-standard NFC application.

Specifically, the processor may obtain current scenario information ofthe electronic device in response to a fact that the transactioninstruction received by the NFC controller does not carry the firstidentifier. The processor searches the one or more pieces of usescenario information of the one or more non-standard NFC applicationsfor use scenario information corresponding to the current scenarioinformation, and determines a second identifier and SE locationinformation that correspond to the found use scenario information. Theprocessor determines a second target SE from the at least two SEs basedon the found SE location information, and sends the transactioninstruction to the second target SE. The second target SE receives thetransaction instruction. The processor indicates the found secondidentifier to the second target SE. The second target SE determines,based on the second identifier indicated by the processor, a secondtarget NFC application from NFC applications carried in the secondtarget SE, where the second target NFC application is a non-standard NFCapplication. The second target SE runs the second target NFCapplication, to execute the transaction instruction.

In this embodiment of this application, even if some NFC applications donot support the AID, after receiving the transaction instruction, theelectronic device may determine, based on the current scenarioinformation of the electronic device, an SE in which a non-standard NFCapplication to be accessed by the transaction instruction is located.Therefore, automatic routing to the SE in which the non-standard NFCapplication to be accessed by the transaction instruction is located canbe implemented.

In addition, the electronic device may further determine, based on thecurrent scenario information of the electronic device, the non-standardNFC application to be accessed by the transaction instruction. In thisway, the SE can send the transaction instruction to the non-standard NFCapplication to be accessed by the transaction instruction.

With reference to the first aspect, in another possible design manner,the NFC controller may store a routing table, where the routing tableincludes the first identifiers and the SE location information of theplurality of NFC applications. The routing table may further include anon-standard card default item, and the non-standard card default itemis used to point to, when the transaction instruction does not carry thefirst identifier, an SE corresponding to the current scenarioinformation of the electronic device. The processor may determine thesecond target SE from the at least two SEs based on the found SElocation information, and indicates the second target SE to the NFCcontroller. The NFC controller may configure, in response to theindication of the processor, the non-standard card default item to pointto the second target SE. The NFC controller may send the transactioninstruction to the second target SE to which the non-standard carddefault item points.

With reference to the first aspect, in another possible design manner,the second target SE indicated by the SE location informationcorresponding to the current scenario information may or may not be theSE to which the route of the NFC controller points. After finding the SElocation information, the electronic device may determine whether the SEindicated by the SE location information is an SE to which thenon-standard card default item in the routing table points. If the SEindicated by the SE location information is the SE to which thenon-standard card default item points, the NFC controller may directlytransmit the received transaction instruction to the SE, and the SEautomatically activates the non-standard NFC application indicated bythe identifier corresponding to the current scenario information, andexecutes the transaction instruction, to complete the transaction. Ifthe SE indicated by the SE location information is not the SE to whichthe non-standard card default item points, the NFC controller mayconfigure the non-standard card default item in the routing table topoint to the SE, and then transmit the received transaction instructionto the SE, and the SE automatically activates the non-standard NFCapplication indicated by the identifier corresponding to the currentscenario information, and executes the transaction instruction, tocomplete the transaction.

With reference to the first aspect, in another possible design manner,the scenario information includes at least one or more of geographicallocation information, time information, and operation information. Thegeographical location information is used to indicate a geographicallocation at which the corresponding non-standard NFC application can beused; the time information is used to indicate a time for which thecorresponding non-standard NFC application can be used; and theoperation information is used to indicate an operation performed by auser on the electronic device before the corresponding non-standard NFCapplication is used.

With reference to the first aspect, in another possible design manner, afirst SE in the at least two SEs carries a first NFC application and asecond NFC application. An NFC service verification manner supported bythe first NFC application is a direct card swiping mode in which userverification does not need to be performed. For example, the first NFCapplication may be a “bus card” application. An NFC service verificationmanner supported by the second NFC application is averification-required mode in which the user verification needs to beperformed. For example, the second NFC application may be a “bank card”application. The “bank card” application corresponds to theverification-required mode, and a transaction can be completed onlyafter the user verification (for example, password verification,fingerprint verification, face verification, iris authentication,voiceprint authentication, or behavior authentication) succeeds. The“bus card” application corresponds to the direct card swiping mode, anda transaction can be completed without the user verification.

The processor of the electronic device activates the first NFCapplication in response to a setting operation of the user, to set thefirst NFC application as a default NFC application of the electronicdevice. In response to a preset shortcut operation of the user, theprocessor deactivates the first NFC application, and automaticallyactivates the second NFC application, to set the second NFC applicationas a default NFC application of the electronic device.

The foregoing solution may be understood as a concept of “direct cardswiping is normal, and verification is temporary” proposed in thisembodiment of this application. In the electronic device, the first NFCapplication may be a normal default NFC application, and the second NFCapplication may be a temporary default NFC application.

Specifically, usually, the default NFC application of the electronicdevice may be the first NFC application (the first NFC application maybe set as the default NFC application by the user). In this way, theuser can complete, at any time by using the electronic device, atransaction with a card reader or a POS terminal corresponding to thefirst NFC application. When the user expects to use the second NFCapplication for payment, the user may input a preset shortcut operationto the electronic device. In response to the preset shortcut operation,the electronic device may temporarily set the second NFC application asa default NFC application, so that the electronic device can complete atransaction with a card reader or a POS terminal corresponding to thesecond NFC application.

In this embodiment of this application, even if one NFC managementapplication manages the first NFC application (for example, the “buscard” application, a “social security card” application, or a “vehiclekey” application) in the direct card swiping mode and the second NFCapplication (for example, the “bank card” application) in theverification-required mode, the user does not need to frequently set adefault NFC application in the NFC management application. Theelectronic device can complete, at any time, the transaction with thecard reader or the POS terminal corresponding to the first NFCapplication, and can complete, in response to the preset shortcutoperation, the transaction with the card reader or the POS terminalcorresponding to the second NFC application.

According to a second aspect, an embodiment of this application providesan electronic device. The electronic device includes a processor and atleast two secure elements SEs; a first SE in the at least two SEscarries a first NFC application and a second NFC application; an NFCservice verification manner supported by the first NFC application is adirect card swiping mode in which user verification does not need to beperformed; an NFC service verification manner supported by the secondNFC application is a verification-required mode in which the userverification needs to be performed; and the user verification is atleast any one of password verification, fingerprint verification, faceverification, iris authentication, voiceprint authentication, behaviorauthentication, and the like. The processor activates the first NFCapplication in response to a setting operation of a user, to set thefirst NFC application as a default NFC application of the electronicdevice. In response to a preset shortcut operation of the user, theprocessor deactivates the first NFC application, and automaticallyactivates the second NFC application, to set the second NFC applicationas a default NFC application of the electronic device.

According to a third aspect, an embodiment of this application providesan automatic routing method for an SE, and the method is applied to anelectronic device. The electronic device includes at least two SEs, andeach of the at least two SEs carries at least one NFC application. Theelectronic device stores first identifiers and SE location informationof a plurality of NFC applications, and the SE location informationindicates an SE that carries a corresponding NFC application. The methodmay include: The electronic device receives a transaction instruction.The electronic device searches, in response to a fact that thetransaction instruction carries a first identifier, the stored SElocation information for SE location information corresponding to thefirst identifier carried in the transaction instruction. The electronicdevice determines a first target SE from the at least two SEs based onthe SE location information.

With reference to the third aspect, in a possible design manner, theelectronic device may further determine, based on the first identifiercarried in the transaction instruction, a first target NFC applicationfrom NFC applications carried in the first target SE. The electronicdevice runs the first target NFC application by using the first targetSE, to execute the transaction instruction.

With reference to the third aspect, in another possible design manner,the first identifier may be an AID.

With reference to the third aspect, in another possible design manner,an NFC management application of the first target NFC applicationcarries a first identifier of the first target NFC application and SElocation information of the first target NFC application; the SElocation information of the first target NFC application indicates thefirst target SE that carries the first target NFC application; and theNFC management application is configured to manage one or more NFCapplications. The method may further include: The electronic deviceobtains the first identifier of the first target NFC application and theSE location information of the first target NFC application that aretransmitted when the NFC management application of the first target NFCapplication registers with a default payment application of theelectronic device, where during installation, the NFC managementapplication registers with the default payment application. Theelectronic device stores the first identifier of the first target NFCapplication and the SE location information of the first target NFCapplication.

With reference to the third aspect, in another possible design manner,the electronic device further stores one or more pieces of use scenarioinformation, one or more pieces of SE location information, and one ormore second identifiers of one or more non-standard NFC applications:the non-standard NFC application does not support the AID; the secondidentifier is used to identify the non-standard NFC application, and thesecond identifier is not the first identifier (for example, the AID);and the use scenario information is used to indicate scenarioinformation of using a corresponding non-standard NFC application. Themethod may further include: The electronic device obtains currentscenario information of the electronic device in response to a fact thatthe transaction instruction does not carry the first identifier. Theelectronic device searches the one or more pieces of use scenarioinformation of the one or more non-standard NFC applications for usescenario information corresponding to the current scenario information,and determines a second identifier and SE location information thatcorrespond to the found use scenario information. The electronic devicedetermines a second target SE from the at least two SEs based on thefound SE location information. The electronic device determines, basedon the found second identifier, a second target NFC application from NFCapplications carried in the second target SE. The electronic device runsthe second target NFC application by using the second target SE, toexecute the transaction instruction.

With reference to the third aspect, in another possible design manner,the electronic device stores a routing table, where the routing tableincludes the first identifiers and the SE location information of theplurality of NFC applications. The routing table further includes anon-standard card default item, and the non-standard card default itemis used to point to, when the transaction instruction does not carry thefirst identifier, an SE corresponding to the current scenarioinformation of the electronic device. That the electronic devicedetermines a second target SE from the at least two SEs based on thefound SE location information includes: The electronic device determinesthe second target SE from the at least two SEs based on the found SElocation information, and configures the non-standard card default itemto point to the second target SE.

With reference to the third aspect, in another possible design manner,the scenario information includes at least one or more of geographicallocation information, time information, and operation information. Thegeographical location information is used to indicate a geographicallocation at which the corresponding non-standard NFC application can beused; the time information is used to indicate a time for which thecorresponding non-standard NFC application can be used; and theoperation information is used to indicate an operation performed by auser on the electronic device before the corresponding non-standard NFCapplication is used.

With reference to the third aspect, in another possible design manner, afirst SE in the at least two SEs carries a first NFC application and asecond NFC application; an NFC service verification manner supported bythe first NFC application is a direct card swiping mode in which userverification does not need to be performed; an NFC service verificationmanner supported by the second NFC application is averification-required mode in which the user verification needs to beperformed; and the user verification is at least any one of passwordverification, fingerprint verification, face verification, irisauthentication, voiceprint authentication, behavior authentication, andthe like. The method may further include: The electronic deviceactivates the first NFC application in response to a setting operationof the user, to set the first NFC application as a default NFCapplication of the electronic device. In response to a preset shortcutoperation of the user, the electronic device deactivates the first NFCapplication, and automatically activates the second NFC application, toset the second NFC application as a default NFC application of theelectronic device.

With reference to the third aspect, in another possible design manner,after the second NFC application completes a transaction or after apreset time since the electronic device automatically activates thesecond NFC application, the electronic device deactivates the second NFCapplication, and automatically activates the first NFC application, toset the first NFC application as a default NFC application of theelectronic device.

According to a fourth aspect, an embodiment of this application providesan automatic activation method for an NFC application. The method may beapplied to an electronic device. The electronic device includes at leasttwo SEs; a first SE in the at least two SEs carries a first NFCapplication and a second NFC application; an NFC service verificationmanner supported by the first NFC application is a direct card swipingmode in which user verification does not need to be performed; an NFCservice verification manner supported by the second NFC application is averification-required mode in which the user verification needs to beperformed; and the user verification is at least any one of passwordverification, fingerprint verification, face verification, irisauthentication, voiceprint authentication, behavior authentication, andthe like.

The method may include: The electronic device activates the first NFCapplication in response to a setting operation of a user, to set thefirst NFC application as a default NFC application of the electronicdevice. In response to a preset shortcut operation of the user, theelectronic device deactivates the first NFC application, andautomatically activates the second NFC application, to set the secondNFC application as a default NFC application of the electronic device.

With reference to the fourth aspect, in a possible design manner, themethod may further include: after the second NFC application completes atransaction or after a preset time since the electronic deviceautomatically activates the second NFC application, the electronicdevice deactivates the second NFC application, and automaticallyactivates the first NFC application, to set the first NFC application asa default NFC application of the electronic device.

According to a fifth aspect, an embodiment of this application providesan NFC chip. The NFC chip includes an NFC controller; and the NFCcontroller stores first identifiers and secure element SE locationinformation of a plurality of NFC applications, and the SE locationinformation indicates an SE that carries a corresponding NFCapplication. The NFC controller receives a transaction instruction. TheNFC controller searches, in response to a fact that the transactioninstruction carries a first identifier, the SE location informationstored in the NFC controller for SE location information correspondingto the first identifier carried in the transaction instruction. The NFCcontroller determines a first target SE from at least two SEs based onthe found SE location information. The NFC controller sends thetransaction instruction to the first target SE.

With reference to the fifth aspect, in a possible design manner, thefirst identifier may be an AID.

With reference to the fifth aspect, in another possible design manner,an NFC management application of a first target NFC application carriesa first identifier of the first target NFC application and SE locationinformation of the first target NFC application; the SE locationinformation of the first target NFC application indicates the firsttarget SE that carries the first target NFC application; and the NFCmanagement application is configured to manage one or more NFCapplications. The NFC controller is configured to receive the firstidentifier of the first target NFC application and the SE locationinformation of the first target NFC application that are transmittedwhen the NFC management application of the first target NFC applicationregisters with a default payment application of an electronic device,where during installation, the NFC management application of the firsttarget NFC application registers with the default payment application ofthe electronic device. The NFC controller is further configured to storethe first identifier of the first target NFC application and the SElocation information of the first target NFC application, where the SElocation information of the first target NFC application indicates thefirst target SE that carries the first target NFC application.

With reference to the fifth aspect, in another possible design manner,that the NFC controller sends the transaction instruction to the firsttarget SE includes: The NFC controller is specifically configured to: ifthe first target SE is an SE to which a route of the NFC controllerpoints, directly send, by the NFC controller, the transactioninstruction to the first target SE; or if the first target SE is not anSE to which a route of the NFC controller points, modify, by the NFCcontroller, the route to point to the first target SE, and then send thetransaction instruction to the first target SE.

With reference to the fifth aspect, in another possible design manner,the NFC controller stores a routing table, where the routing tableincludes the first identifiers and the SE location information of theplurality of NFC applications. The routing table further includes anon-standard card default item, and the non-standard card default itemis used to point to, when the transaction instruction does not carry thefirst identifier, an SE corresponding to current scenario information ofthe electronic device. The NFC controller is further configured to: whenthe transaction instruction does not carry the first identifier, receiveindication information used to indicate a second target SE; andconfigure the non-standard card default item to point to the secondtarget SE. The NFC controller is further configured to send thetransaction instruction to the second target SE to which thenon-standard card default item points.

With reference to the fifth aspect, in another possible design manner,that the NFC controller is further configured to send the transactioninstruction to the second target SE to which the non-standard carddefault item points includes: The NFC controller is specificallyconfigured to: if the second target SE is an SE to which thenon-standard card default item points, directly send, by the NFCcontroller, the transaction instruction to the second target SE to whichthe non-standard card default item points; or if the second target SE isnot an SE to which the non-standard card default item points, configure,by the NFC controller, the non-standard card default item in the routingtable to point to the second target SE, and then send the transactioninstruction to the second target SE to which the non-standard carddefault item points.

According to a sixth aspect, an embodiment of this application providesa computer storage medium. The computer storage medium may includecomputer instructions, and when the computer instructions are run on anelectronic device, the electronic device is enabled to perform themethod according to any one of the third aspect and the fourth aspect orthe possible design manners of the third aspect and the fourth aspect.

According to a seventh aspect, an embodiment of this applicationprovides a computer program product. When the computer program productruns on a computer, the computer is enabled to perform the methodaccording to any one of the third aspect and the fourth aspect or thepossible design manners of the third aspect and the fourth aspect.

It may be understood that the method according to any one of the thirdaspect and the fourth aspect or the possible design manners of the thirdaspect and the fourth aspect, the NFC chip according to the fifthaspect, the computer storage medium according to the sixth aspect, andthe computer program product according to the seventh aspect that areprovided above may all be implemented in the electronic device accordingto any one of the first aspect and the second aspect or the possibledesign manners of the first aspect and the second aspect. Therefore, forbeneficial effects that can be achieved by the method, the NFC chip, thecomputer storage medium, and the computer program product, refer to thebeneficial effects achieved by the corresponding electronic deviceprovided above. Details are not described herein again.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1A is a schematic diagram of an NFC communications system accordingto an embodiment of this application;

FIG. 1B is a schematic form diagram of three SEs of an electronic deviceaccording to an embodiment of this application;

FIG. 2 is a schematic block diagram of registration and use proceduresof an NFC application according to an embodiment of this application;

FIG. 3 is a schematic diagram of a hardware structure of an electronicdevice according to an embodiment of this application;

FIG. 4 is another schematic block diagram of registration and useprocedures of an NFC application according to an embodiment of thisapplication:

FIG. 5A is a flowchart of an automatic routing method for an SEaccording to an embodiment of this application;

FIG. 5B is a schematic diagram of a switching instance of a default NFCapplication according to an embodiment of this application:

FIG. 6(a) and FIG. 6(b) are another schematic diagram of a switchinginstance of a default NFC application according to an embodiment of thisapplication;

FIG. 7 is another schematic diagram of a switching instance of a defaultNFC application according to an embodiment of this application; and

FIG. 8 is another schematic diagram of a switching instance of a defaultNFC application according to an embodiment of this application.

DESCRIPTION OF EMBODIMENTS

The following terms “first” and “second” are merely intended for apurpose of descriptions, and shall not be understood as an indication orimplication of relative importance or implicit indication of a quantityof indicated technical features. Therefore, a feature limited by “first”or “second” may explicitly or implicitly include one or more features.In the descriptions of the embodiments of this application, unlessotherwise specified, “a plurality of” means two or more.

FIG. 1A is a schematic diagram of an NFC communications system accordingto an embodiment of this application. As shown in FIG. 1A, the NFCcommunications system may include an electronic device 100 and anexternal card reader 101.

The electronic device 100 and the external card reader 101 each includean NFC chip, and may communicate with each other through NFC. Forexample, the external card reader 101 may be a bank POS terminal, a busPOS terminal, a door card reader, or the like shown in FIG. 2.Alternatively, the external card reader 101 may be a social securitycard reader or the like. A specific form of the external card reader 101is not limited in this embodiment of this application.

For ease of understanding, some concepts related to the embodiments ofthis application are provided as examples for reference. Details are asfollows:

NFC application: The NFC application is an application configured toimplement near field communication, and has an emulation function ofemulating a non-contact IC card. Based on different applicationscenarios, there may be different types of NFC applications, forexample, a bus application, an access control application, and a bankcard application.

The NFC application has an AID, but not all NFC applications support useof the AID. An NFC application that uses the AID supports AIDidentification, that is, the electronic device 100 can identify, basedon an AID carried in a transaction instruction, an NFC application to beaccessed by the transaction instruction.

To implement card emulation, the electronic device 100 needs to includethree functional entities: a device host (device host. DH), an NFCcontroller (NFC controller, NFCC), and an SE.

DH: The DH may be responsible for NFCC management, for example,initialization, configuration, and power management.

NFCC: The NFCC may be responsible for physical data transmission throughan antenna. The DH may be included in a main chip of the electronicdevice 100, and the NFCC may be included in an NFC chip of theelectronic device 100.

SE: The SE may be responsible for providing a secure executionenvironment (for example, authentication or authorization) and asensitive data storage environment for the NFC application. The SE is asecure element chip. The SE may simultaneously carry a plurality of NFCapplications.

The electronic device 100 may include one or more SEs. If the electronicdevice 100 includes a plurality of SEs, these SEs may exist in differentforms.

For example, as shown in FIG. 1B, the electronic device 100 may includethree SEs. The three SEs may be respectively an SE 1 in a form of asubscriber identity module (subscriber identification module, SIM) card,an SE 2 packaged together with an NFC chip, and an eSE in a form of amain chip (an application processor (application processor, AP) shown inFIG. 1B) of the electronic device 100. Hardware (an SE 3 shown in FIG.1B) of the eSE is deployed in a server located in a cloud. The SE 3 isreferred to as host-based card emulation (host card emulation, HCE).

Certainly, the SE is merely used as an example. In this embodiment, theSE may alternatively exist in another form in the electronic device 100.For example, the SE exists in a form of an SD card. For another example,the SE exists in a form of a universal integrated circuit card(Universal Integrated Circuit Card, UICC). This is not limited in thisembodiment.

After an NFC application is downloaded to a corresponding SE, the NFCapplication may register with a “default payment application” (that is,perform S1 shown in FIG. 2). In this way, only when using an NFCapplication, a user can set a default NFC application in a selectioninterface of the default payment application of the electronic device.

Specifically, the user may control, by performing the followingoperations, the electronic device 100 to display the selection interfaceof the default payment application: The user taps an application icon ofa “setting” application, and the electronic device 100 displays thesetting interface; the user taps an “NFC” option in the settinginterface, and the electronic device 100 displays an NFC settinginterface; and the user taps a “default payment application” option inthe NFC setting interface, and the electronic device 100 displays theselection interface of the default payment application. The selectioninterface of the default payment application includes one or moreoptions of one or more NFC management applications (configured to manageone or more NFC applications) and one or more options of the one or moreNFC applications.

For example, the selection interface of the default payment applicationmay include an option of a “wallet” (for example, HiWallet) application(that is, an NFC management application) in an NFC APP 201 in FIG. 2,and options of a “vehicle key” application, a “social security card”application, and an “NFC payment APP” application (that is, NFCapplications) in the NFC APP 201 in FIG. 2. The “wallet” application isan NFC management application configured to manage NFC applications,that is, a “bank card” application and a “bus card” application. Forexample, the “NFC payment APP” application may be a “Jingdong payment”application shown in FIG. 2.

If the user taps an option of an NFC application (an independent NFCapplication, for example, a “social security card” application) in theselection interface of the default payment application, it indicatesthat the user selects the NFC application (for example, the “socialsecurity card” application) as a default NFC application. It should benoted that an NFC management application of the “independent NFCapplication” in this embodiment of this application includes only oneNFC application. To be specific, the NFC management application managesonly one NFC application. For example, it is assumed that the “socialsecurity card” application shown in FIG. 2 is an independent NFCapplication. If the user taps an option of the “social security card”application in the selection interface of the default paymentapplication, it indicates that the user selects the “social securitycard” application as a default NFC application. As shown in FIG. 2, the“social security card” application is carried in an SE 1.

If the user taps an option of an NFC management application (the NFCmanagement application manages a plurality of NFC applications, forexample, a “wallet” application manages a “bank card” application and a“bus card” application) in the selection interface of the defaultpayment application, the user may continue to select, as a defaultpayment application, an NFC application (for example, the “bank card”application) from the NFC applications (for example, the “bank card”application and the “bus card” application) managed by the NFCmanagement application (for example, the “wallet” application).

After the user selects the default NFC application, the NFCC may modifya routing table in the NFCC (that is, perform S2 in FIG. 2), so that therouting table points to an SE in which the default NFC application islocated. In this way, after the NFCC receives any transactioninstruction, the routing table in the NFCC points to the SE. In otherwords, a route of the NFC controller points to the SE.

For example, assuming that the default NFC application selected by theuser is the “social security card” application shown in FIG. 2, and the“social security card” application shown in FIG. 2 is carried in the SE1, the NFCC may modify the routing table in the NFCC (that is, performS2 in FIG. 2), so that the routing table points to the SE 1. In thisway, after the NFCC receives any transaction instruction, the routingtable in the NFCC points to the SE 1. In other words, the route of theNFC controller points to the SE 1.

For another example, assuming that the default NFC application selectedby the user is the “bank card” application shown in FIG. 2, and the“bank card” application shown in FIG. 2 is carried in an SE 2, the NFCCmay modify the routing table in the NFCC (that is, perform S2 in FIG.2), so that the routing table points to the SE 2. In this way, after theNFCC receives any transaction instruction, the routing table in the NFCCpoints to the SE 2. In other words, the route of the NFC controllerpoints to the SE 2.

Usually, only an SE to which the route of the NFCC points can undertakean NFC transaction, that is, process the transaction instruction. Whenthe transaction instruction needs to access an NFC application carriedin another SE, the transaction cannot be performed. The another SE isnot the SE to which the route of the NFC controller points.Specifically, because the route of the NFC controller cannot point to anSE in which an NFC application to be accessed by the transactioninstruction is located, the NFC controller cannot send the transactioninstruction to the SE, and the NFC application in the SE cannot executethe transaction instruction. Consequently, the transaction cannot becompleted.

For example, with reference to FIG. 1A and FIG. 1B and FIG. 2, the routeof the NFCC points to an SE 1 in a form of a SIM card. When theelectronic device 100 is close to a card reader (or a POS terminal), theelectronic device may receive a transaction instruction sent by the cardreader (or the POS terminal). If an NFC application (for example, the“social security card” application shown in FIG. 2) to be accessed bythe transaction instruction is carried in the SE 1, the NFC controllermay send the transaction instruction to the SE 1, and the correspondingNFC application (for example, the “social security card” applicationshown in FIG. 2) in the SE 1 executes the transaction instruction, tocomplete the transaction. If an NFC application (for example, the“vehicle key” application shown in FIG. 2) to be accessed by thetransaction instruction is not carried in the SE 1, but is carried in anSE 2 or an SE 3 (for example, the “vehicle key” application shown inFIG. 2 is carried in the SE 2), because the route of the NFC controllercannot point to the SE 2 or the SE 3, the NFC controller cannot send thetransaction instruction to the SE 2 or the SE 3, and the NFC applicationin the SE 2 or the SE 3 cannot execute the transaction instruction.Consequently, the transaction cannot be completed.

This embodiment provides an automatic routing method for an SE. Themethod may be applied to an electronic device that includes a pluralityof SEs, and the electronic device has an NFC function. According to themethod provided in this embodiment, even if the electronic deviceincludes the plurality of SEs, the electronic device can beautomatically routed to an SE in which an NFC application to be accessedby a transaction instruction is located.

FIG. 3 is a schematic structural diagram of an electronic device 100according to an embodiment. As shown in FIG. 3, the electronic device100 may include a processor 310, an external memory interface 320, aninternal memory 321, a universal serial bus (universal serial bus, USB)interface 330, a charging management module 340, a power managementmodule 341, a battery 342, an antenna 1, an antenna 2, a mobilecommunications module 350, a wireless communications module 360, anaudio module 370, a speaker 370A, a receiver 370B, a microphone 370C, aheadset jack 370D, a sensor module 380, a button 390, a motor 391, anindicator 392, a camera 393, a display 394, a SIM card interface 395,and the like.

The sensor module 380 may include a pressure sensor 380A, a gyro sensor380B, a barometric pressure sensor 380C, a magnetic sensor 380D, anacceleration sensor 380E, a distance sensor 380F, an optical proximitysensor 380G, a fingerprint sensor 380H, a temperature sensor 380J, atouch sensor 380K, an ambient light sensor 380L, a bone conductionsensor 380M, and the like.

It may be understood that a structure shown in this embodiment does notconstitute a specific limitation on the electronic device 100. In someother embodiments, the electronic device 200 may include more or fewercomponents than those shown in the figure, combine some components,split some components, or have different component arrangements. Thecomponents shown in the figure may be implemented by using hardware,software, or a combination of software and hardware.

The processor 310 may include one or more processing units. For example,the processor 310 may include an AP, a modem processor, a graphicsprocessing unit (graphics processing unit, GPU), an image signalprocessor (image signal processor, ISP), a controller, a memory, a videocodec, a digital signal processor (digital signal processor, DSP), abaseband processor, and/or a neural-network processing unit(neural-network processing unit, NPU). Different processing units may beindependent devices, or may be integrated into one or more processors.

In some embodiments, the electronic device 100 may include an SE in aform of an AR and the SE may be referred to as an eSE. Hardware (the SE3 shown in FIG. 1B) of the eSE is deployed in a server located in acloud.

The controller may be a nerve center and a command center of theelectronic device 100. The controller may generate an operation controlsignal based on an instruction operation code and a time sequencesignal, to complete control of instruction fetching and instructionexecution.

A memory may be further disposed in the processor 310, and is configuredto store instructions and data. In some embodiments, the memory in theprocessor 310 is a cache. The memory may store instructions or data thatis just used or cyclically used by the processor 310. If the processor310 needs to use the instructions or the data again, the processor 310may directly invoke the instructions or the data from the memory. Thisavoids repeated access and reduces a waiting time of the processor 310.Therefore, system efficiency is improved.

The charging management module 340 is configured to receive a charginginput from the charger. The charger may be a wireless charger or a wiredcharger. The power management module 341 is configured to connect thebattery 342 and the charging management module 340 to the processor 310.The power management module 341 receives an input of the battery 342and/or the charging management module 340, and supplies power to theprocessor 310, the internal memory 321, an external memory, the display394, the camera 393, the wireless communications module 360, and thelike.

A wireless communication function of the electronic device 100 may beimplemented by using the antenna 1, the antenna 2, the mobilecommunications module 350, the wireless communications module 360, themodem processor, the baseband processor, and the like.

The antenna 1 and the antenna 2 are configured to: transmit and receiveelectromagnetic wave signals. Each antenna in the electronic device 100may be configured to cover one or more communication bands. Differentantennas may be further multiplexed, to improve antenna utilization. Forexample, the antenna 1 may be multiplexed as a diversity antenna in awireless local area network. In some other embodiments, the antenna maybe used in combination with a tuning switch.

The mobile communications module 350 may provide a wirelesscommunication solution that includes 2G/3G/4G/5G or the like and that isapplied to the electronic device 100. The mobile communications module350 may include at least one filter, a switch, a power amplifier, a lownoise amplifier (low noise amplifier, LNA), and the like. The mobilecommunications module 350 may receive an electromagnetic wave by usingthe antenna 1, perform processing such as filtering or amplification onthe received electromagnetic wave, and transmit the electromagnetic waveto the modem processor for demodulation. The mobile communicationsmodule 350 may further amplify a signal modulated by the modemprocessor, and convert the signal into an electromagnetic wave forradiation by using the antenna 1. The wireless communications module 360may provide a wireless communication solution that includes NFC, awireless local area network (wireless local area networks, WLAN) (forexample, a wireless fidelity (wireless fidelity, Wi-Fi) network),Bluetooth (Bluetooth, BT), a global navigation satellite system (globalnavigation satellite system, GNSS), frequency modulation (frequencymodulation, FM), an infrared (infrared, IR) technology, or the like andthat is applied to the electronic device 100. The wirelesscommunications module 360 may be one or more components integrating atleast one communications processor module. The wireless communicationsmodule 360 receives an electromagnetic wave by using the antenna 2,performs frequency modulation and filtering processing on theelectromagnetic wave signal, and sends a processed signal to theprocessor 310. The wireless communications module 360 may furtherreceive a to-be-sent signal from the processor 310, perform frequencymodulation and amplification on the signal, and convert the signal intoan electromagnetic wave for radiation by using the antenna 2.

In some embodiments, the wireless communications module 360 may includean NFC chip, and the NFC chip may include an NFCC. The NFC chip canperform processing such as amplification, analog-to-digital conversion,digital-to-analog conversion, and storage on a signal. A DH is includedin a main chip of the electronic device 100. The DH may be integratedinto the processor of the electronic device 100.

In some embodiments, the electronic device 100 may include an SE 2packaged together with an NFC chip. The SE 2 is packaged in the NFC chipof the electronic device 100.

In some embodiments, the antenna 1 and the mobile communications module350 in the electronic device 100 are coupled, and the antenna 2 and thewireless communications module 360 in the electronic device 100 arecoupled, so that the electronic device 100 can communicate with anetwork and another device by using a wireless communicationstechnology.

The electronic device 100 implements a display function through the GPU,the display 394, the application processor, and the like. The GPU is amicroprocessor for image processing, and connects the display 394 to theapplication processor. The GPU is configured to: perform mathematicaland geometric calculation, and render an image. The processor 310 mayinclude one or more GPUs that execute program instructions to generateor change display information. The display 394 is configured to displaya text, an image, a video, or the like.

The electronic device 100 may implement a photographing function throughthe ISP, the camera 393, the video codec, the GPU, the display 394, theapplication processor, and the like.

The ISP is configured to process data fed back by the camera 393. Forexample, during photographing, a shutter is pressed, and light istransmitted to a photosensitive element of the camera through a lens. Anoptical signal is converted into an electrical signal, and thephotosensitive element of the camera transmits the electrical signal tothe ISP for processing, to convert the electrical signal into a visibleimage. The ISP may further perform algorithm optimization on noise,brightness, and complexion of the image. The ISP may further optimizeparameters such as exposure and color temperature of a photographingscenario. In some embodiments, the ISP may be disposed in the camera393.

The camera 393 is configured to capture a static image or a video. Anoptical image of an object is generated through the lens, and isprojected onto the photosensitive element. The photosensitive elementmay be a charge coupled device (charge coupled device, CCD) or acomplementary metal-oxide-semiconductor (complementarymetal-oxide-semiconductor, CMOS) photoelectric transistor. Thephotosensitive element converts an optical signal into an electricalsignal, and then transmits the electrical signal to the ISP forconverting the electrical signal into a digital image signal. The ISPoutputs the digital image signal to the DSP for processing. The DSPconverts the digital image signal into an image signal in a standardformat such as an RGB format or a YUV format. In some embodiments, theelectronic device 100 may include one or N cameras 393, where N is apositive integer greater than 1.

The digital signal processor is configured to process a digital signal,and may process another digital signal in addition to the digital imagesignal. For example, when the electronic device 100 selects a frequency,the digital signal processor is configured to perform Fouriertransformation and the like on frequency energy.

The video codec is configured to: compress or decompress a digitalvideo. The electronic device 100 may support one or more video codecs.In this way, the electronic device 100 can play or record videos in aplurality of coding formats, for example, moving picture experts group(moving picture experts group, MPEG)-1, MPEG-2, MPEG-3, and MPEG-4.

The NPU is a neural-network (neural-network, NN) computing processor.The NPU quickly processes input information with reference to astructure of a biological neural network, for example, a transfer modebetween human brain neurons, and may further continuously performself-learning. The NPU can implement applications such as intelligentcognition of the electronic device 100, such as image recognition,facial recognition, speech recognition, and text understanding.

The external memory interface 320 may be configured to connect to anexternal storage card such as a micro SD card, to extend a storagecapability of the electronic device 100. The external storage cardcommunicates with the processor 310 through the external memoryinterface 320, to implement a data storage function. For example, filessuch as music and a video are stored in the external storage card. Insome embodiments, the electronic device 100 may include an SE in a formof an external storage card.

The internal memory 321 may be configured to store computer executableprogram code. The executable program code includes instructions. Theprocessor 310 performs various function applications of the electronicdevice 100 and data processing by running the instructions stored in theinternal memory 321. The internal memory 321 may include a programstorage area and a data storage area.

The electronic device 100 may implement audio functions, for example,music playing and recording, by using the audio module 370, the speaker370A, the receiver 370B, the microphone 370C, the headset jack 370D, theapplication processor, and the like.

The audio module 370 is configured to convert digital audio informationinto an analog audio signal output, and is also configured to convert ananalog audio input into a digital audio signal. The audio module 370 maybe further configured to: code and decode an audio signal. In someembodiments, the audio module 370 may be disposed in the processor 310,or some functional modules in the audio module 370 are disposed in theprocessor 310.

The speaker 370A, also referred to as a “horn”, is configured to convertan audio electrical signal into a sound signal. The electronic device100 may be configured to: listen to music or answer a hands-free call byusing the speaker 370A. The receiver 370B, also referred to as an“earpiece”, is configured to convert an audio electrical signal into asound signal. When a call is answered or speech information is receivedby using the electronic device 100, the receiver 370B may be put closeto a human ear to receive a speech.

The microphone 370C, also referred to as a “mike” or a “microphone”, isconfigured to convert a sound signal into an electrical signal. At leastone microphone 370C may be disposed in the electronic device 100. Insome other embodiments, two microphones 370C may be disposed in theelectronic device 100, to collect a sound signal and further implement anoise reduction function. In some other embodiments, three, four, ormore microphones 370C may alternatively be disposed in the electronicdevice 100, to collect a sound signal, reduce noise, identify a soundsource, implement a directional recording function, and the like.

The headset jack 370D is configured to connect to a wired headset. Theheadset jack 370D may be the USB interface 330, or may be a 3.5 mm openmobile terminal platform (open mobile terminal platform, OMTP) standardinterface or a cellular telecommunications industry association of theUSA (cellular telecommunications industry association of the USA, CTIA)standard interface.

The button 390 may include a power button, a volume button, and thelike. The button 390 may be a mechanical button, or may be a touchbutton. The electronic device 100 may receive a key input, and generatea key signal input related to a user setting and function control of theelectronic device 100. The motor 391 may generate a vibration prompt.Different application scenarios (for example, a time reminder,information receiving, an alarm clock, and a game) may also correspondto different vibration feedback effects. The indicator 392 may be anindicator light, and may be configured to indicate a charging status anda power change, or may be configured to indicate a message, a missedcall, a notification, and the like.

The SIM card interface 395 is configured to connect to a SIM card. TheSIM card may be inserted into the SIM card interface 395 or removed fromthe SIM card interface 395, to implement contact with or separation fromthe electronic device 100. The electronic device 100 may support one orN SIM card interfaces, where N is a positive integer greater than 1. TheSIM card interface 395 may support a nano SIM card, a micro SIM card, aSIM card, and the like. In some embodiments, the electronic device 100may include an SE 1 in a form of a SIM card. The SE 1 is packaged in theSIM card of the electronic device 100.

All technical solutions in the following embodiments may be implementedin the electronic device 100 that has the foregoing hardwarearchitecture. The following describes in detail an automatic routingmethod for an SE provided in the embodiments. For ease of understanding,descriptions are provided in the following embodiments by using anexample in which an electronic device includes three SEs (as shown inFIG. 1B).

In this embodiment of this application, an identifier of an NFCapplication may be a first identifier or a second identifier. The firstidentifier is an identifier of a standard NFC application, and thesecond identifier is an identifier of a non-standard NFC application.For example, the first identifier may be an AID, and the standard NFCapplication is an NFC application that supports the AID. The secondidentifier is not an AID, and the non-standard NFC application does notsupport the AID.

An embodiment of this application provides an automatic routing methodfor an SE. An electronic device 100 may download a plurality of NFCapplications from a server. The plurality of NFC applications may becarried in one or more SEs of the electronic device 100. Each SE maycarry at least one NFC application.

A user may set a default NFC application in the electronic device 100.For example, the user sets an NFC application 1 as the default NFCapplication of the electronic device 100. Assuming that the NFCapplication 1 is carried in an SE 1, a route of an NFCC of theelectronic device 100 points to the SE 1. However, when the electronicdevice 100 is close to a card reader or a POS terminal, an NFCapplication to be accessed by a transaction instruction received by theelectronic device 100 may not be the NFC application in the SE 1. Forexample, the NFC application to be accessed by the transactioninstruction may be an NFC application 2, and the NFC application 2 iscarried in an SE 2. Because the route of the NFCC of the electronicdevice 100 does not point to the SE 1, the transaction cannot beperformed.

In this embodiment of this application, regardless of whether the routeof the NFCC points to an SE in which the NFC application to be accessedby the transaction instruction is located, the electronic device 100(the NFCC of the electronic device 100) can be automatically routed tothe SE in which the NFC application to be accessed by the transactioninstruction is located, and interact with the card reader or the POSterminal to complete the transaction.

The NFCC of the electronic device 100 may store first identifiers and SElocation information of a plurality of NFC applications, and the SElocation information indicates an SE that carries a corresponding NFCapplication. For example, the NFCC of the electronic device 100 maymaintain a routing table. The NFCC of the electronic device 100 mayconfigure one or more pieces of routing information of one or more NFCapplications in the routing table, where the routing information of theNFC application may include a first identifier and SE locationinformation of the NFC application. The SE location informationindicates an SE that carries the NFC application, namely, an SE that isof the electronic device 100 and in which the NFC application iscarried. For example, the first identifier may be an AID of the NFCapplication. Certainly, the first identifier includes but is not limitedto the AID.

Then, when the electronic device 100 is close to a card reader or a POSterminal, the NFCC of the electronic device 100 may receive atransaction instruction from the card reader or the POS terminal. Thetransaction instruction may or may not include a first identifier (forexample, an AID). Therefore, as shown in FIG. 5A, after receiving thetransaction instruction, the NFCC of the electronic device 100 maydetermine whether the transaction instruction includes the AID. If thetransaction instruction includes the AID, the NFCC may search therouting table for SE location information corresponding to the AID, andthen transmit the received transaction instruction to an SE (that is, afirst target SE) indicated by the SE location information. To bespecific, the NFCC can be automatically routed, based on the firstidentifier carried in the transaction instruction, to an SE in which anNFC application to be accessed by the transaction instruction islocated.

Further, after receiving the transaction instruction, the SE (that is,the first target SE) indicated by the SE location information maydetermine a first target NFC application (that is, the NFC applicationto be accessed by the transaction instruction) from NFC applicationscarried in the first target SE, and run the first target NFCapplication, to execute the transaction instruction.

Specifically, the first target SE may send the transaction instructionto the NFC application (that is, the first target NFC application) to beaccessed by the transaction instruction, and the first target NFCapplication executes the transaction instruction, to complete thetransaction.

In this embodiment of this application, that the electronic device 100is close to a card reader or a POS terminal may be specifically: Adistance between the electronic device 100 and the card reader or thePOS terminal is less than a preset distance threshold. There is the cardreader or the POS in this embodiment of this application.

For example, Table 1 shows AID identifiers of a plurality of NFCapplications shown in FIG. 2 or FIG. 4.

TABLE 1 AID of an NFC application NFC application AID Social securitycard AID-1 Bank card AID-2 Bus card AID-3 Vehicle key AID-4 NFC paymentAPP AID-5 . . . . . .

As shown in Table 1, an AID of the “social security card” application isthe AID-1; an AID of the “bank card” application is the AID-2; an AID ofthe “bus card” application is the AID-3: an AID of the “vehicle key”application is the AID-4; and an AID of the “NFC payment” application isthe AID-5. For example, the “NFC payment APP” application may be a“Meituan payment” application or the “Jingdong payment” applicationshown in FIG. 2.

For example, Table 2 shows an instance of a routing table according toan embodiment of this application.

TABLE 2 Routing table AID SE location information AID-1 SE locationinformation 1 (indicating an SE 1) AID-2 SE location information 2(indicating an SE 2) AID-3 SE location information 2 (indicating the SE2) AID-4 SE location information 2 (indicating the SE 2) AID-5 SElocation information 3 (indicating an SE 3) . . . . . .

The SE location information may be an identifier of an SE that carriesthe NFC application. As shown in Table 2, the SE location information 1may be an identifier of the SE 1, the SE location information 2 may bean identifier of the SE 2, and the SE location information 3 may be anidentifier of the SE 3.

In addition, it can be learned from Table 2 that the AID-1 correspondsto the SE location information 1, and the “social security card”application identified by the AID-1 shown in Table 1 is carried in theSE 1 (that is, an SE 1 in a form of a SIM card shown in FIG. 4); the“bank card” application identified by the AID-2, the “bus card”application identified by the AID-3, and the “vehicle key” applicationidentified by the AID-4 shown in Table 1 are carried in the SE 2 (thatis, an SE 2 packaged together with an NFC chip shown in FIG. 4); and the“NFC payment APP” application identified by the AID-5 shown in Table 1is carried in the SE 3 (that is, an SE 3 in a form of HCE shown in FIG.4).

It may be understood that the SE indicated by the SE locationinformation may or may not be the SE to which the route of the NFCCpoints. After finding the SE location information corresponding to theAID, the electronic device 100 may determine that the SE indicated bythe SE location information is the SE to which the route of the NFCCpoints. If the SE is the SE to which the route of the NFCC points, theNFCC may directly transmit a received transaction instruction to the SE,and an NFC application that is to be accessed by the transactioninstruction and that is in the SE executes the transaction instruction,to complete the transaction. If the SE is not the SE to which the routeof the NFCC points, the NFCC may modify the route to point to the SE,and then transmit a received transaction instruction to the SE, and anNFC application that is to be accessed by the transaction instructionand that is in the SE executes the transaction instruction, to completethe transaction.

For example, assuming that a default NFC application is a “socialsecurity card” application shown in FIG. 4, and the “social securitycard” application is carried in the SE 1 shown in FIG. 4, the route ofthe NFCC points to the SE 1.

If the NFCC of the electronic device 100 receives a transactioninstruction 1 that carries the AID-1, the NFCC may search the routingtable shown in Table 2 for the SE location information 1 correspondingto the AID-1. The SE location information 1 indicates that an NFCapplication to be accessed by the transaction instruction 1 is carriedin the SE 1. The electronic device 100 may directly transmit thetransaction instruction 1 to the SE 1, and the NFC application (the“social security card” application corresponding to the AID-1 shown inTable 1) that is to be accessed by the transaction instruction 1 andthat is in the SE 1 executes the transaction instruction 1, to completethe transaction.

If the NFCC of the electronic device 100 receives a transactioninstruction 2 that carries the AID-3, the NFCC may search the routingtable shown in Table 2 for the SE location information 2 correspondingto the AID-3. The SE location information 2 indicates that an NFCapplication to be accessed by the transaction instruction 2 is carriedin the SE 2. The electronic device 100 may modify the route to point tothe SE 2, and then transmit the transaction instruction 2 to the SE 2,and the NFC application (the “bus card” application corresponding to theAID-3 shown in Table 1) that is to be accessed by the transactioninstruction 2 and that is in the SE 2 executes the transactioninstruction 2, to complete the transaction.

In this embodiment of this application, one NFC management applicationmay manage one or more NFC applications. The NFC management applicationcarries a first identifier and SE location information of the NFCapplication managed by the NFC management application. When an NFCmanagement application of the NFC application (for example, a firsttarget NFC application) is installed on the electronic device 100, theNFC management application may register with a default paymentapplication of the electronic device 100. In this way, the defaultpayment application may transmit the first identifier and the SElocation information of the NFC application to the NFCC of theelectronic device 100, and the NFCC of the electronic device 100 maystore the first identifier and the SE location information of the NFCapplication.

For example, the NFCC of the electronic device 100 may maintain arouting table, where the routing table includes correspondences betweenAIDs and SE location information of a plurality of NFC applications. Inthis way, even if the electronic device 100 includes a plurality of SEs,the electronic device 100 may find, from the routing table based on anAID carried in a transaction instruction. SE location information of anNFC application to be accessed by the transaction instruction, anddetermine an SE that carries the NFC application to be accessed by thetransaction instruction. To be specific, the NFCC can be automaticallyrouted, based on the first identifier carried in the transactioninstruction, to an SE in which the NFC application to be accessed by thetransaction instruction is located.

In this embodiment of this application, the transaction instruction maybe an instruction sent by any type of card reader (for example, ahandheld mobile card reader or a fixed card reader) or any type of POSterminal (for example, a handheld mobile POS terminal or a fixed POSterminal). The transaction instructions may be instructions of varioustypes or in various frame formats. For example, the transactioninstructions may be instructions in frame formats such as an applicationprotocol data unit (Application Protocol Data Unit, APDU) frame format,a single-byte short frame format, and a long frame format. For anotherexample, the transaction instructions may be instructions of types suchas a 14443 TYPE (TYPE) A, a 14443 TYPE B, international standardizationorganization (International Standardization Organization, ISO) 18092,and ISO15693.

A method for configuring the routing table by the NFCC is describedherein in this embodiment of this application.

In some embodiments, when an NFC management application of an NFCapplication is installed, routing information that corresponds to theNFC application and that is in the routing table shown in Table 2 may beconfigured according to a route configuration command delivered by a DHof the electronic device 100. The routing information of the NFCapplication may include an AID and SE location information of the NFCapplication. The SE location information is used to indicate an SE inwhich the NFC application is carried. The foregoing default paymentapplication is managed by the DH.

Specifically, an NFC application (for example, a “social security card”application) is downloaded to an SE (for example, an SE 1 in a form of aSIM card) of the electronic device 100. After determining that the NFCapplication is successfully downloaded to the SE (for example, the SE 1)of the electronic device 100, the SE may send, to the DH of theelectronic device 100, a message used to indicate that the NFCapplication is successfully downloaded. After receiving the message, theDH of the electronic device 100 may send a route configuration commandto the NFCC of the electronic device 100. The route configurationcommand may be locally predefined in the electronic device 100, or maybe delivered to the DH of the electronic device 100 by a server thatprovides a download resource for the NFC application. The routeconfiguration command is used to indicate the NFCC to configure therouting information of the NFC application in the routing table. TheNFCC of the electronic device 100 may configure the routing informationof the NFC application in the routing table according to the routeconfiguration command. The routing information may include the AID andthe SE location information of the NFC application.

For example, a process of performing route configuration in the routingtable is described by using an example in which the NFCC configuresrouting information of an “access control card” application. Detaileddescriptions of processes of configuring routing information of the“social security card” application, the “vehicle key” application, the“bus card” application, and the like are similar to the detaileddescriptions of the process of configuring the routing informationcorresponding to the “access control card” application.

Based on an operation of a user, the electronic device 100 may downloadthe “access control card” application to an SE of the electronic device100. As shown in FIG. 4, the “access control card” application isdownloaded to the SE 3. After the “access control card” application issuccessfully downloaded to the SE 3, the SE 3 may send, to the DH of theelectronic device 100, a message indicating that the “access controlcard” application is successfully downloaded. In response to themessage, the DH of the electronic device 100 may send a routeconfiguration command to the NFCC of the electronic device 100. Forexample, the route configuration command includes the routinginformation such as an AID-6 and SE location information 3 of the“access control card” application. The NFCC of the electronic device 100may perform route configuration according to the route configurationcommand delivered by the DH, that is, configure the routing informationof the “access control card” application in the routing table shown inTable 2. For example, the configured routing information is routinginformation (an AID-6 and SE location information 3) in a routing tableshown in Table 3. In this way, the routing information of the “accesscontrol card” application is configured, and subsequently, whether atransaction instruction needs to access the NFC application may bedetermined by using the routing information.

TABLE 3 Routing table AID SE location information AID-1 SE locationinformation 1 (indicating an SE 1) AID-2 SE location information 2(indicating an SE 2) AID-3 SE location information 2 (indicating the SE2) AID-4 SE location information 2 (indicating the SE 2) AID-5 SElocation information 3 (indicating an SE 3) AID-6 SE locationinformation 3 (indicating the SE 3) . . . . . .

It may be understood that after the “access control card” application issuccessfully downloaded to the SE 3, the SE 3 may send, to the DH of theelectronic device 100, a message indicating that the “access controlcard” application is successfully downloaded. In response to themessage, the DH of the electronic device 100 may register the “accesscontrol card” application with a default payment application (that is,perform Sa shown in FIG. 4). Then, the DH of the electronic device 100may send a route configuration command to the NFCC of the electronicdevice 100, to indicate the NFCC of the electronic device 100 toconfigure the routing information in the routing table (that is, performSb shown in FIG. 4).

It may be understood that the NFC management application (for example, a“wallet” application) may manage one or more NFC applications. Forexample, a “wallet” application (namely, an NFC management application)shown in FIG. 2 or FIG. 4 manages two NFC applications, a “bank card”application and a “bus card” application. Different NFC applicationssupport different NFC service verification manners. Specifically, asshown in FIG. 5B, a “bank card” application corresponds to averification-required mode, and a transaction can be completed onlyafter user verification (for example, password verification, fingerprintverification, face verification, iris authentication, voiceprintauthentication, or behavior authentication) succeeds. A “bus card”application corresponds to a direct card swiping mode, and a transactioncan be completed without user verification.

For example, for the “bus card” application, a process of interactionbetween the electronic device 100 and a card reader or a POS terminal(for example, a bus POS terminal) may include: (1) The bus POS terminalkeeps sending an NFC field strength signal. (2) When the electronicdevice 100 is close to the bus POS terminal, the electronic device 100may receive the field strength signal sent by the bus POS terminal. (3)The NFCC of the electronic device 100 may return a response to the busPOS terminal in response to the field strength signal without userverification. (4) After receiving the response, the bus POS terminalsends a transaction instruction to the electronic device 100. (5) TheNFCC of the electronic device 100 receives the transaction instruction,and completes the transaction according to the transaction instruction.

For another example, in an example in which the “bank card” applicationis for payment at a supermarket cashier, a process of interactionbetween the electronic device 100 and a supermarket POS terminal mayinclude: (1) The supermarket POS terminal keeps sending an NFC fieldstrength signal. (2) When the electronic device 100 is close to thesupermarket POS terminal, the electronic device 100 may receive thefield strength signal sent by the supermarket POS terminal. (3) Theelectronic device 100 needs to invoke user verification (for example,password verification, fingerprint verification, face verification, irisauthentication, voiceprint authentication, or behavior authentication),and sends a response to the supermarket POS terminal only after the userverification succeeds. (4) After receiving the response, the supermarketPOS terminal sends a transaction instruction to the electronic device100. (5) The NFCC of the electronic device 100 receives the transactioninstruction, and completes the transaction according to the transactioninstruction.

However, referring to FIG. 6(a), if a user sets the “bus card”application in the “wallet” application as a default NFC application,another NFC application (for example, a “bank card” application) in the“wallet” application is disabled. In this case, if the electronic device100 is close to the supermarket POS terminal, a transaction between theelectronic device 100 and the supermarket POS terminal may fail becauseuser verification cannot be invoked. If the user expects to use the“bank card” application for payment, the user may set the “bank card”application in the “wallet” application as a default NFC application,and another NFC application (for example, a “bus card” application) inthe “wallet” application is disabled. In this case, if the electronicdevice 100 is close to the bus POS terminal, a transaction between theelectronic device 100 and the bus POS terminal fails. If the userexpects to use the “bus card” application for payment again, the usermay reset the “bus card” application in the “wallet” application as adefault NFC application. In daily life of the user, the user may need tofrequently set the default NFC application in the “wallet” applicationthrough manual switching. Consequently, user experience is relativelypoor.

Based on this, a concept of “direct card swiping is normal, andverification is temporary” is proposed in this embodiment of thisapplication. An NFC management application of the electronic device 100may manage the following NFC applications: a first NFC application (forexample, a “bus card” application, a “social security card” application,or a “vehicle key” application) and a second NFC application (forexample, a “bank card” application). An NFC service verification mannersupported by the first NFC application is a direct card swiping mode inwhich user verification does not need to be performed. An NFC serviceverification manner supported by the second NFC application is averification-required mode in which the user verification needs to beperformed. The user verification is at least any one of passwordverification, fingerprint verification, iris authentication, voiceprintauthentication, behavior authentication, or face verification.

The automatic routing method for an SE and an automatic activationmethod for an NFC application provided in this embodiment of thisapplication may include the following solutions: The first NFCapplication and the second NFC application of the electronic device 100are carried in a first SE. The first NFC application may be a normaldefault NFC application, and the second NFC application may be atemporary default NFC application. Specifically, the default NFCapplication of the electronic device 100 may be the first NFCapplication (the first NFC application may be set as the default NFCapplication by the user). In this way, the user can complete, at anytime by using the electronic device 100, a transaction with a cardreader or a POS terminal corresponding to the first NFC application.When the user expects to use the second NFC application for payment, theuser may input a preset shortcut operation to the electronic device 100.In response to the preset shortcut operation, the electronic device 100may temporarily set the second NFC application as a default NFCapplication, so that the electronic device 100 can complete atransaction with a card reader or a POS terminal corresponding to thesecond NFC application.

In this embodiment of this application, even if one SE includes thefirst NFC application (for example, the “bus card” application, the“social security card” application, or the “vehicle key” application) inthe direct card swiping mode and the second NFC application (forexample, the “bank card” application) in the verification-required mode,the user does not need to frequently set the default NFC application.The electronic device 100 can complete, at any time, the transactionwith the card reader or the POS terminal corresponding to the first NFCapplication, and can complete, in response to the preset shortcutoperation, the transaction with the card reader or the POS terminalcorresponding to the second NFC application.

For example, the preset shortcut operation may be at least any one of adouble-tap operation performed by the user on a power button (orreferred to as a lock screen button) of the electronic device 100, apreset tap operation performed by the user on the electronic device 100(for example, N consecutive tap operations performed on a rear housingof the electronic device 100, where N≥2, and N is a positive integer), apreset operation (for example, a touch and hold operation) performed bythe user on a Home button of the electronic device 100, an operation ofinputting preset fingerprint information by the user to the electronicdevice 100, and the like.

Further, after the electronic device 100 completes the transaction withthe card reader or the POS terminal corresponding to the second NFCapplication, or after a preset time since the electronic device 100 setsthe second NFC application as the default NFC application, the defaultNFC application of the electronic device 100 is switched to the firstNFC application again. For example, the preset time may be 1 minute, 2minutes, or 30 seconds. The preset time may be set by the user, or thepreset time may be a fixed time length preconfigured in the electronicdevice 100.

For example, it is assumed that the second NFC application is the “bankcard” application in the foregoing instance, and the first NFCapplication is the “bus card” application. The “bank card” applicationand the “bus card” application are included in the “wallet” application,and therefore the user may manage the “bank card” application and the“bus card” application in the “wallet” application. For example, theuser may set the “bank card” application or the “bus card” applicationin the “wallet” application as a default NFC application of theelectronic device 100.

For example, referring to FIG. 6(a), the user may set the “bus card”application as a default NFC application. A method in which the usersets the “bus card” application in the “wallet” application as thedefault NFC application is not described herein again. After the usersets the “bus card” application as the default NFC application, the “buscard” application may be used as a normal default NFC application of theelectronic device 100. If the electronic device 100 is close to a busPOS terminal, the NFCC of the electronic device 100 does not need toperform user verification, and the “bus card” application may execute atransaction instruction to complete the transaction with the bus POSterminal. When the user expects to use the “bank card” application forpayment (for example, shopping in a supermarket), the user may input apreset shortcut operation to the electronic device 100, and then placethe electronic device 100 close to a supermarket POS terminal. Inresponse to the preset shortcut operation, the electronic device 100 mayset the “bank card” application as a temporary default NFC application.Therefore, when the electronic device 100 is close to the supermarketPOS terminal, the electronic device 100 may successfully invoke userverification, and after the user verification succeeds, the “bank card”application executes a transaction instruction to complete thetransaction with the supermarket POS terminal. Then, after theelectronic device 100 completes the transaction with the supermarket POSterminal (not shown in FIG. 6(b)), or after a preset time (for example,1 minute) since the electronic device 100 sets the “bank card”application to the default NFC application, the default NFC applicationof the electronic device 100 is switched to the “bus card” applicationagain. In this way, the default NFC application of the electronic device100 is switched to the “bus card” application in the direct card swipingmode.

In this embodiment of this application, the electronic device 100 mayset a first NFC application (for example, the “bus card” application,the “social security card” application, or the “vehicle key”application) in a direct card swiping card as a normal default NFCapplication, and set a second NFC application (for example, the “bankcard” application) in a verification-required mode as a temporarydefault NFC application. In this way, the user can complete, at any timeby using the electronic device 100, a transaction with a card reader ora POS terminal corresponding to the first NFC application. When the userexpects to use the second NFC application for payment, the user mayinput a preset shortcut operation to the electronic device 100. Inresponse to the preset shortcut operation, the electronic device 100 maytemporarily set the second NFC application as a default NFC application,so that the electronic device 100 can complete a transaction with a cardreader or a POS terminal corresponding to the second NFC application.

It may be understood that one NFC management application may include onefirst NFC application, or one NFC management application may include aplurality of first NFC applications. For example, a “wallet” applicationmay include a plurality of NFC applications such as a “bus card”application, a “social security card” application, and a “vehicle key”application.

When the “wallet” application includes the plurality of NFC applicationssuch as the “bus card” application, the “social security card”application, and the “vehicle key” application, the electronic device100 may activate a corresponding NFC application based on an AID in atransaction instruction sent by a card reader or a POS terminal, and thecorresponding NFC application executes the transaction instruction tocomplete the transaction.

It should be noted that, to ensure security of the user verification,the user verification (fingerprint verification shown in FIG. 2 and FIG.4) may be performed in a trusted execution environment (trust executionenvironment. TEE). Procedures that have a relatively low securityrequirement, for example, a procedure in which the user sets the defaultNFC application and a procedure in which the NFC application registers,may be executed in a rich execution environment (rich executionenvironment, REE) in which a rich instruction can be executed.

It may be understood that not all NFC applications support use of afirst identifier (for example, the AID). For example, the firstidentifier is the AID. For example, some bus cards do not support use ofthe AID. Therefore, in some embodiments, the transaction instructionreceived by the NFCC of the electronic device 100 does not include theAID.

Based on this case, the routing table may include a non-standard carddefault item. The non-standard card default item is used to point to,when the transaction instruction does not include the AID, an SE (thatis, a second target SE) corresponding to current scenario information ofthe electronic device 100. The electronic device 100 (for example, anNFC management application such as a “wallet” application of theelectronic device 100) may store query information of each non-standardNFC application. The query information of the non-standard NFCapplication may include use scenario information, SE locationinformation, and a second identifier of the non-standard NFCapplication. The use scenario information of the non-standard NFCapplication is used to indicate scenario information of using thenon-standard NFC application.

The second identifier is used to identify the non-standard NFCapplication, and the second identifier is not the first identifier (forexample, the AID). The second identifier may be a number allocated bythe electronic device 100 to the non-standard NFC application.

The use scenario information may include at least one or more ofgeographical location information, time information, and operationinformation.

The geographical location information is used to indicate a geographicallocation at which the non-standard NFC application can be used. Forexample, a geographical location at which a “bus card” applicationcorresponding to Xi'an can be used is Xi'an, and a geographical locationat which a “bus card” application corresponding to Shenzhen can be usedis Shenzhen. For another example, a geographical location at which a“social security card” application corresponding to the home can be usedis a geographical location corresponding to the home, and a geographicallocation at which a “vehicle key” application can be used is a garage.

The time information is used to indicate a time for which thecorresponding non-standard NFC application can be used. The timeinformation may be a time about which the electronic device 100 collectsstatistics and for which the user often uses the non-standard NFCapplication. For example, if the electronic device 100 learns, throughstatistics collection, that the user often uses the “social securitycard” application in two time periods, that is, 7:00 to 7:30 and 18:00to 18:30, time information of the “social security card” application maybe 7:00 to 7:30 and 18:00 to 18:30.

The operation information is used to indicate an operation performed bythe user on the electronic device 100 before the non-standard NFCapplication is used. For example, it is assumed that operationinformation of the “social security card” application may be adouble-tap operation performed by the user on a body of the electronicdevice 100, and operation information of the “vehicle key” applicationmay be a shake operation performed by the user on the body of theelectronic device 100.

The SE location information indicates an SE that carries thenon-standard NFC application, namely, an SE that is of the electronicdevice 100 and in which the non-standard NFC application is carried.

For example, the electronic device 100 (for example, a scenariomanagement module 701 shown in FIG. 7) may store one or more pieces ofuse scenario information, one or more pieces of SE location information,and one or more second identifiers of one or more non-standard NFCapplications. For example, the electronic device 100 (for example, thescenario management module 701 shown in FIG. 7) may maintain anon-standard card information table. The non-standard card informationtable may include query information of a non-standard NFC applicationinstalled in the electronic device 100. The query information of thenon-standard NFC application may include use scenario information, SElocation information, and a second identifier of the non-standard NFCapplication.

It should be noted that the query information in the non-standard cardinformation table maintained by the scenario management module 701 shownin FIG. 7 may be configured when a corresponding non-standard NFCapplication is installed in the electronic device 10. When thenon-standard NFC application is installed in the electronic device 100,a method for configuring the query information of the non-standard NFCapplication in the electronic device 100 (for example, the scenariomanagement module 701 shown in FIG. 7) is described in the followingembodiment. The scenario management module 701 in this embodiment ofthis application may be an NFC management application, for example, theforegoing “wallet” application, configured to manage a plurality of NFCapplications.

For example, it is assumed that the electronic device 100 manages threenon-standard NFC applications: a non-standard NFC application 1 (forexample, a “bus card” application corresponding to Shenzhen), anon-standard NFC application 2 (for example, a “bus card” applicationcorresponding to Xi'an), and a non-standard NFC application 3 (forexample, a “bus card” application corresponding to Shanghai) that areshown in FIG. 7. An identifier (for example, a number) of thenon-standard NFC application 1 is an identifier 1, the non-standard NFCapplication 1 is carried in an SE 1, and scenario information of usingthe non-standard NFC application 1 is scenario information 1. Anidentifier (for example, a number) of the non-standard NFC application 2is an identifier 2, the non-standard NFC application 2 is carried in anSE 2, and scenario information of using the non-standard NFC application2 is scenario information 2. An identifier (for example, a number) ofthe non-standard NFC application 3 is an identifier 3, the non-standardNFC application 3 is carried in an SE 3, and scenario information ofusing the non-standard NFC application 3 is scenario information 3.

Table 4 shows an instance of a non-standard card information tableaccording to an embodiment of this application. Table 4 shows queryinformation of the non-standard NFC application 1 (for example, the“bus” application corresponding to Shenzhen), the non-standard NFCapplication 2 (for example, the “bus” application corresponding toXi'an), and the non-standard NFC application 3 (for example, the “buscard” application corresponding to Shanghai).

TABLE 4 Non-standard card information table Identifier of a Scenario SElocation information non-standard NFC information application Identifier1 Scenario SE location information 1 information 1 (indicating an SE 1)Identifier 2 Scenario SE location information 2 information 2(indicating an SE 2) Identifier 3 Scenario SE location information 3information 3 (indicating an SE 3) . . . . . . . . .

Then, when the electronic device 100 is close to a card reader or a POSterminal, the NFCC of the electronic device 100 may receive atransaction instruction from the card reader or the POS terminal. Thetransaction instruction may or may not include an AID. Therefore, asshown in FIG. 5A, after receiving the transaction instruction, the NFCCof the electronic device 100 may determine whether the transactioninstruction includes the AID. If the transaction instruction does notinclude the AID, the electronic device 100 may obtain current scenarioinformation of the electronic device 100. The electronic device 100 maysearch the non-standard card information table for an identifier (forexample, the identifier 2) and SE location information (for example, theSE location information indicates the SE 2) that are of the non-standardNFC application and that correspond to the current scenario information.The NFCC of the electronic device 100 configures the non-standard carddefault item in the routing table to point to an SE (that is, a secondtarget SE, for example, the SE 2) indicated by the found SE locationinformation. In this way, the NFCC of the electronic device 100 maytransmit the transaction instruction to the SE (that is, the secondtarget SE, for example, the SE 2) to which the non-standard card defaultitem points.

Further, the electronic device 100 may notify, of the found identifier(for example, the identifier 2) of the non-standard NFC application, theSE (for example, the SE 2) indicated by the SE location information. Inthis way, after receiving the transaction instruction, the SE (forexample, the SE 2) indicated by the SE location information mayautomatically activate the non-standard NFC application (that is, asecond target NFC application) corresponding to the identifier (forexample, the identifier 2), and execute the transaction instruction, tocomplete the transaction.

For example, in this embodiment of this application, the NFC transactionprocess is described in detail herein with reference to FIG. 7.

First, when the electronic device 100 is close to a card reader or a POSterminal, the NFCC of the electronic device 100 receives a transactioninstruction from the card reader or the POS terminal. The NFCC of theelectronic device 100 determines that the transaction instruction doesnot include an AID. A scenario information obtaining module 702 of theelectronic device 100 obtains current scenario information of theelectronic device 100.

Then, the scenario information obtaining module 702 transmits thecurrent scenario information to the scenario management module 701. Thescenario management module 701 searches the non-standard cardinformation table for an identifier (for example, the identifier 2) andSE location information (for example, the SE location informationindicates the SE 2) that are of the non-standard NFC application andthat correspond to the current scenario information.

Subsequently, the scenario management module 701 may indicate the SElocation information to the NFCC, so that the NFCC configures thenon-standard card default item in the routing table to point to an SE(for example, the SE 2) indicated by the SE location information. Inthis way, the NFCC may transmit the transaction instruction to the SE(for example, the SE 2) to which the non-standard card default itempoints.

In addition, the scenario management module 701 may further notify, ofthe found identifier (for example, the identifier 2) of the non-standardNFC application, the SE (for example, the SE 2) indicated by the SElocation information. In this way, after receiving the transactioninstruction, the SE (for example, the SE 2) indicated by the SE locationinformation may automatically activate the non-standard NFC applicationcorresponding to the identifier (for example, the identifier 2), andexecute the transaction instruction, to complete the transaction.

The scenario information may include at least one or more ofgeographical location information, time information, and operationinformation. In this case, the scenario information obtaining module 702may include a geographical location obtaining module (for example, a GPSpositioning module), a time information obtaining module (for example, aclock and a calendar of the electronic device 100), and the like.

It may be understood that the SE (for example, the SE 2) indicated bythe SE location information corresponding to the current scenarioinformation may or may not be an SE to which a route of the NFCC points.After finding the SE location information, the electronic device 100 maydetermine whether the SE indicated by the SE location information is anSE to which the non-standard card default item in the routing tablepoints. If the SE is the SE to which the non-standard card default itempoints, the NFCC may directly transmit the received transactioninstruction to the SE, and the SE automatically activates thenon-standard NFC application indicated by the identifier correspondingto the current scenario information, and executes the transactioninstruction, to complete the transaction. If the SE is not the SE towhich the non-standard card default item points, the NFCC may configurethe non-standard card default item in the routing table to point to theSE, and then transmit the received transaction instruction to the SE,and the SE automatically activates the non-standard NFC applicationindicated by the identifier corresponding to the current scenarioinformation, and executes the transaction instruction, to complete thetransaction.

For example, it is assumed that a default NFC application is thenon-standard NFC application 1 shown in FIG. 7, the non-standard NFCapplication 1 is carried in the SE 1 shown in FIG. 7, and thenon-standard card default item in the routing table of the NFCC pointsto the SE 1.

If the NFCC of the electronic device 100 receives a transactioninstruction 3, where the transaction instruction 3 does not include anAID, and the electronic device 100 learns that the current scenarioinformation of the electronic device 100 is the scenario information 2shown in Table 4, the electronic device 100 may find, from Table 4, theidentifier 2 and the SE location information 2 that correspond to thescenario information 2. The identifier 2 is an identifier of thenon-standard NFC application 2, and the SE location information 2indicates the SE 2. In this case, the NFCC of the electronic device 100may configure the non-standard card default item in the routing table topoint to the SE 2. Then, the NFCC transmits the transaction instruction3 to the SE 2, the SE 2 automatically activates the non-standard NFCapplication 2 indicated by the identifier 2, and the activatednon-standard NFC application 2 executes the transaction instruction 3,to complete the transaction.

If the NFCC of the electronic device 100 receives a transactioninstruction 4, where the transaction instruction 4 does not include anAID, and the electronic device 100 learns that the current scenarioinformation of the electronic device 100 is the scenario information 1shown in Table 4, the electronic device 100 may find, from Table 4, theidentifier 1 and the SE location information 1 that correspond to thescenario information 1. The identifier 1 is an identifier of thenon-standard NFC application 1, and the SE location information 1indicates the SE 1. In this case, the NFCC of the electronic device 100may configure the non-standard card default item in the routing table topoint to the SE 1, and directly transmit the transaction instruction 4to the SE 1, the SE 1 automatically activates the non-standard NFCapplication 1 indicated by the identifier 1, and the activatednon-standard NFC application 1 executes the transaction instruction 4,to complete the transaction.

A method for configuring the non-standard card information table by theelectronic device 100 is described herein in this embodiment of thisapplication.

In some embodiments, when an NFC application is installed, queryinformation that corresponds to the NFC application and that is in thenon-standard card information table shown in Table 4 may be configuredaccording to a route configuration command delivered by the DH of theelectronic device 100. The query information of the non-standard NFCapplication may include an identifier, SE location information, andscenario information of the non-standard NFC application.

Specifically, when a non-standard NFC application (for example, anon-standard NFC application 4 shown in FIG. 7) is installed, the NFCapplication is downloaded to an SE (for example, the SE 2) of theelectronic device 100. After determining that the non-standard NFCapplication is successfully downloaded to the SE (for example, the SE 2)of the electronic device 100, the SE may send, to the DH of theelectronic device 100, a message used to indicate that the non-standardNFC application is successfully downloaded. In response to the message,the DH of the electronic device 100 may register the non-standard NFCapplication (for example, the non-standard NFC application 4 shown inFIG. 7) with a default payment application (that is, perform S-A shownin FIG. 7). When registering, in response to the message, thenon-standard NFC application 4 shown in FIG. 7 with the default paymentapplication, the DH may configure, in the default payment application,an identifier 4, SE location information indicating an SE 4, andscenario information 4 of the non-standard NFC application 4. Finally,the DH of the electronic device 100 may configure, in the non-standardcard information table maintained by the scenario management module 701,query information of the non-standard NFC application (for example, thenon-standard NFC application 4 shown in FIG. 7) (that is, perform S-Bshown in FIG. 7). For example, the query information of the non-standardNFC application 4 is query information (an identifier 4, SE locationinformation 4, and scenario information 4) in a non-standard cardinformation table shown in Table 5. In this way, the query informationof the non-standard NFC application 4 is configured, and subsequently,whether a transaction instruction needs to access the NFC applicationmay be determined by using the query information.

TABLE 5 Non-standard card information table identifier of a Scenario SElocation information non-standard NFC information application Identifier1 Scenario SE location information 1 information 1 (indicating an SE 1)Identifier 2 Scenario SE location information 2 information 2(indicating an SE 2) Identifier 3 Scenario SE location information 3information 3 (indicating an SE 3) Identifier 4 Scenario SE locationinformation 4 information 4 (indicating the SE 2) . . . . . . . . .

It should be noted that scenario information of some non-standard NFCapplications is configured in the foregoing manner when the non-standardNFC application is downloaded. For example, geographical locationinformation of a “bus card” application corresponding to each place isconfigured when the “bus card” application is downloaded. The scenarioinformation of some non-standard NFC applications is scenarioinformation (for example, geographical location information and/or timeinformation) that is obtained by the electronic device 100 throughstatistics collection and that indicates that the user often uses thenon-standard NFC application after the user uses the non-standard NFCcard for a period of time. For example, scenario information of a“social security card” application is scenario information that isobtained by the electronic device 100 through statistics collection andthat indicates that the user often uses the “social security card”application after the user uses the “social security card” applicationfor a period of time.

In some embodiments, for example, the scenario information is thegeographical location information. As shown in FIG. 8, a “bus card”application corresponding to Beijing is carried in an SE 1, a “bus card”application corresponding to Shenzhen is carried in an SE 2, and a “buscard” application corresponding to Xi'an is carried in an SE 3. The “buscard” application corresponding to Beijing, the “bus card” applicationcorresponding to Shenzhen, and the “bus card” application correspondingto Xi'an are all non-standard NFC applications and do not support anAID. An identifier of the “bus card” application corresponding to Xi'anis an identifier a, geographical location information of the “bus card”application corresponding to Xi'an is Xi'an, and SE location informationof the “bus card” application corresponding to Xi'an indicates that the“bus card” application corresponding to Xi'an is carried in an SE 3.

When a user holds the electronic device 100 close to a POS terminal on abus, the NFCC of the electronic device 100 may receive a transactioninstruction sent by the POS terminal. After receiving the transactioninstruction, the electronic device 100 may obtain information about ageographical location at which the user is currently located. If theobtained geographical location indicates that the user is currently inXi'an, the NFCC of the electronic device 100 may transmit the receivedtransaction instruction to the SE 3, and the SE 3 automaticallyactivates the “bus card” application corresponding to Xi'an, andexecutes the transaction instruction, for example, deducts acorresponding amount from the “bus card” application corresponding toXi'an.

For example, as shown in FIG. 8, the scenario information obtainingmodule (for example, a geographical location obtaining module) 702 mayobtain current geographical location information, and perform S(1) ofsending the current geographical location information to the scenariomanagement module (for example, a bus card management APP, that is, anNFC management application) 701. The scenario management module (forexample, the bus card management APP, that is, the NFC managementapplication) 701 may search the non-standard card information table forthe identifier a and the SE location information indicating the SE 3that are of the “bus card” application that corresponds to Xi'an andthat corresponds to the geographical location information “Xi'an”.Subsequently, the scenario management module 701 may indicate the SElocation information to the NFCC, so that the NFCC configures thenon-standard card default item in the routing table to point to the SE 3indicated by the SE location information. In this way, the NFCC maytransmit the transaction instruction to the SE 3 to which thenon-standard card default item points. In addition, the scenariomanagement module 701 may further notify the SE 3 of the foundidentifier a of the “bus card” application corresponding to Xi'an. Inthis way, after receiving the transaction instruction, the SE 3 mayautomatically activate the “bus card” application that corresponds toXi'an and that corresponds to the identifier a, and execute thetransaction instruction, to complete the transaction.

In some embodiments, for example, the scenario information includes thegeographical location information and the time information. It isassumed that a “vehicle key” application is carried in an SE 1 in a formof a SIM card. The electronic device 100 learns, through statisticscollection, that the user often uses the “vehicle key” application at ageographical location 1 (for example, an underground garage 1) in a timeperiod from 7:30 to 7:50. In this case, if the NFCC receives atransaction instruction, the NFCC may automatically activate the“vehicle key” application 301 when the NFCC learns that a current systemtime (or a time for which the NFCC receives the transaction instruction)is in a time period from 7:30 to 7:50 and the electronic device 100 islocated at the geographical location 1. To be specific, when the currentsystem time is in the time period from 7:30 to 7:50 and the electronicdevice 100 is located at the geographical location 1, the SE 1 to whichthe non-standard card default item points may automatically run the“vehicle key” application. In this way, when the user approaches avehicle door by using the electronic device 100, the vehicle door can beopened without manually activating the “vehicle key” application by theuser.

According to the automatic routing method for an SE provided in thisembodiment of this application, even if some NFC applications do notsupport the AID, after receiving the transaction instruction, theelectronic device 100 can be automatically routed, based on the currentscenario information of the electronic device 100, to an SE in which anon-standard NFC application to be accessed by the transactioninstruction is located.

In the embodiments of this application, the electronic device may bedivided into functional modules based on the foregoing method examples.For example, each function module may be obtained through division basedon each corresponding function, or two or more functions may beintegrated into one processing module. The integrated module may beimplemented in a form of hardware, or may be implemented in a form of asoftware functional module. It should be noted that in the embodimentsof this application, division into the modules is an example and ismerely logical function division, and may be other division in an actualimplementation.

The scenario management module 701 and the scenario informationobtaining module 702 in the foregoing method embodiment may beintegrated into a processor (for example, the processor 310) of theelectronic device 100 for implementation.

An embodiment of this application provides an NFC chip. The NFC chipincludes an NFCC (that is, an NFC controller); and the NFCC stores firstidentifiers and secure element SE location information of a plurality ofNFC applications, and the SE location information indicates an SE thatcarries a corresponding NFC application. The NFCC receives a transactioninstruction. The NFCC searches, in response to a fact that thetransaction instruction carries a first identifier, the SE locationinformation stored in the NFC controller for SE location informationcorresponding to the first identifier carried in the transactioninstruction. The NFCC determines a first target SE from at least two SEsbased on the found SE location information. The NFCC sends thetransaction instruction to the first target SE. For example, the firstidentifier may be an AID.

Further, the NFCC is further configured to: when downloading a firsttarget NFC application, store a first identifier of the first target NFCapplication and SE location information of the first target NFCapplication, where the SE location information of the first target NFCapplication indicates the first target SE that carries the first targetNFC application.

Further, that the NFCC sends the transaction instruction to the firsttarget SE includes: The NFCC is specifically configured to: if the firsttarget SE is an SE to which a route of the NFCC points, directly send,by the NFCC, the transaction instruction to the first target SE; or ifthe first target SE is not an SE to which a route of the NFCC points,modify, by the NFCC, the route to point to the first target SE, and thensend the transaction instruction to the first target SE.

Further, the NFCC stores a routing table, where the routing tableincludes the first identifiers and the SE location information of theplurality of NFC applications. The routing table further includes anon-standard card default item, and the non-standard card default itemis used to point to, when the transaction instruction does not carry thefirst identifier, an SE corresponding to current scenario information ofthe electronic device. The NFCC is further configured to: when thetransaction instruction does not carry the first identifier, receiveindication information used to indicate a second target SE; andconfigure the non-standard card default item to point to the secondtarget SE. The NFCC is further configured to send the transactioninstruction to the second target SE to which the non-standard carddefault item points.

Further, that the NFCC is further configured to send the transactioninstruction to the second target SE to which the non-standard carddefault item points includes: The NFCC is specifically configured to: ifthe second target SE is an SE to which the non-standard card defaultitem points, directly send, by the NFCC, the transaction instruction tothe second target SE to which the non-standard card default item points;or if the second target SE is not an SE to which the non-standard carddefault item points, configure, by the NFCC, the non-standard carddefault item in the routing table to point to the second target SE, andthen send the transaction instruction to the second target SE to whichthe non-standard card default item points.

An embodiment of this application further provides a computer storagemedium. The computer storage medium may include computer instructions.When the computer instructions are run on an electronic device, theelectronic device is enabled to perform the automatic routing method foran SE or the automatic activation method for an NFC application.

An embodiment of this application further provides a computer programproduct. When the computer program product runs on a computer, thecomputer is enabled to perform the automatic routing method for an SE orthe automatic activation method for an NFC application.

Based on the foregoing descriptions of the implementations, a personskilled in the art may clearly understand that for the purpose ofconvenient and brief descriptions, division into the foregoingfunctional modules is merely used as an example for illustration. Inactual application, the foregoing functions can be allocated todifferent functional modules for implementation based on a requirement,that is, an inner structure of an apparatus is divided into differentfunctional modules to implement all or some of the functions describedabove. For a detailed working process of the foregoing system,apparatus, and unit, refer to a corresponding process in the foregoingmethod embodiments. Details are not described herein again.

In the several embodiments provided in the embodiments of thisapplication, it should be understood that the disclosed system,apparatus, and method may be implemented in another manner. For example,the described apparatus embodiment is merely an example. For example,division into the modules or units is merely logical function divisionand may be other division in actual implementation. For example, aplurality of units or components may be combined or integrated intoanother system, or some features may be ignored or not performed. Inaddition, the displayed or discussed mutual couplings or directcouplings or communication connections may be implemented through someinterfaces. The indirect couplings or communication connections betweenthe apparatuses or units may be implemented in electronic, mechanical,or another form.

The units described as separate parts may or may not be physicallyseparate, and parts displayed as units may or may not be physical units,and may be located in one position, or may be distributed on a pluralityof network units. Some or all of the units may be selected based on anactual requirement to achieve the objectives of the solutions in theembodiments of this application.

In addition, functional units in the embodiments of this application maybe integrated into one processing unit, or each of the units may existalone physically, or two or more units may be integrated into one unit.The integrated unit may be implemented in a form of hardware, or may beimplemented in a form of a software functional unit.

When the integrated unit is implemented in a form of a softwarefunctional unit and sold or used as an independent product, theintegrated unit may be stored in a computer-readable storage medium.Based on such an understanding, the technical solutions of theembodiments of this application essentially, or the part contributing tothe conventional technology, or all or some of the technical solutionsmay be implemented in a form of a software product. The computersoftware product is stored in a storage medium, and includes severalinstructions for instructing a computer device (which may be a personalcomputer, a server, a network device, or the like) or a processor toperform all or some of the steps of the methods in the embodiments. Theforegoing storage medium includes any medium that can store programcode, such as a flash memory, a removable hard disk, a read-only memory,a random access memory, a magnetic disk, or an optical disc.

The foregoing descriptions are merely specific implementations of theembodiments of this application, but are not intended to limit theprotection scope of this application. Any variation or replacementwithin the technical scope disclosed in the embodiments of thisapplication shall fall within the protection scope of this application.Therefore, the protection scope of this application shall be subject tothe protection scope of the claims.

1. An electronic device comprising: at least two secure elements (SEs),wherein each of the at least two SEs carries at least one near fieldcommunication (NFC) application; and an NFC controller configured to:store first identifiers and first secure element (SE) locationinformation of a plurality of NFC applications, wherein the first SElocation information indicates an SE that carries a corresponding NFCapplication; receive a transaction instruction; search, in response tothe transaction instruction carrying a second identifier from among thefirst identifiers, a second SE location information, from the first SElocation information, corresponding to the second identifier; determinea first target SE from the at least two SEs based on the second locationinformation, and send the transaction instruction to the first targetSE.
 2. The electronic device of claim 1, wherein the NFC controller isfurther configured to determine, based on the second identifier, a firsttarget NFC application from the NFC applications carried in the firsttarget SE, and wherein the first target SE is configured to: receive thetransaction instruction; and run the first target NFC application toexecute the transaction instruction.
 3. The electronic device of claim1, wherein the first identifier is an application identifier (AID). 4.The electronic device of claim 2, wherein an NFC management applicationof the first target NFC application is configured to manage one or moreNF application, and carries a third identifier of the first target NFCapplication and third SE location information of the first target NFCapplication, wherein the third SE location information indicates thefirst target SE that carries the first target NFC application, andwherein the NFC controller is further configured to: receive the thirdidentifier and the third SE location information that are transmittedwhen the NFC management application registers with a default paymentapplication of the electronic device; and store the third identifier andthe third SE location information.
 5. The electronic device according toclaim 1, wherein the electronic device further comprises a processorconfigured to: store use scenario information, fourth SE locationinformation, and a fourth identifier of a non-standard NFC application,wherein the non-standard NFC application does not support an applicationidentifier (AID), where the fourth identifier identifies thenon-standard NFC application, wherein the fourth identifier is not thesecond identifier, and wherein the use scenario information indicatesscenario information of a corresponding non-standard NFC application;obtain current scenario information of the electronic device in responseto that the transaction instruction received by the NFC controller doesnot carry the second identifier; search the use scenario information ofthe non-standard NFC application for use scenario informationcorresponding to the current scenario information; determine the fourthidentifier and the fourth SE location information that correspond to theuse scenario information; determine a second target SE from the at leasttwo SEs based on the fourth SE location information; send thetransaction instruction to the second target SE; and indicate the fourthidentifier to the second target SE, wherein the second target SE isconfigured to: receive the transaction instruction; determine, based onthe fourth identifier, a second target NFC application from NFCapplications carried in the second target SE, wherein the second targetNFC application is a non-standard NFC application, run the second targetNFC application- to execute the transaction instruction.
 6. Theelectronic device of claim 5, wherein the processor is furtherconfigured to indicate the second target SE to the NFC controller, andwherein the NFC controller is further configured to: store a routingtable comprising the first identifiers, the first SE locationinformation, a non-standard card default item, wherein the non-standardcard default item points to an SE corresponding to the current scenarioinformation when the transaction instruction does not carry the secondidentifier; configure, in response to the indication of the processor,the non-standard card default item to point to the second target SE; andsend the transaction instruction to the second target SE to which thenon-standard card default item points.
 7. The electronic device of claim5, wherein the scenario information comprises at least one or more of:geographical location information indicating a geographical location atwhich the corresponding non-standard NFC application can be used; timeinformation indicating a time for which the corresponding non-standardNFC application can be used; and operation information indicating anoperation performed by a user on the electronic device before thecorresponding non-standard NFC application is used.
 8. The electronicdevice of claim 1, wherein a first SE in the at least two SEs carries afirst NFC application and a second NFC application, wherein a first NFCservice verification manner supported by the first NFC application is adirect card swiping mode in which user verification does not need to beperformed, wherein a second NFC service verification manner supported bythe second NFC application is a verification-required mode in which theuser verification needs to be performed, wherein the user verificationcomprises password verification, fingerprint verification, faceverification, iris authentication, voiceprint authentication, orbehavior authentication, and wherein the processor is further configuredto: activate the first NFC application, in response to a settingoperation of the user, to set the first NFC application as a default NFCapplication of the electronic device; and in response to a presetshortcut operation of the user, deactivate the first NFC application,and automatically activate the second NFC application to set the secondNFC application as the default NFC application.
 9. An electronic devicecomprising: at least two secure elements SEs, wherein a first SE in theat least two SEs carries a first near field communication (NFC)application and a second NFC application, wherein a first NFC serviceverification manner supported by the first NFC application is a directcard swiping mode in which user verification does not need to beperformed, and wherein a second NFC service verification mannersupported by the second NFC application is a verification-required modein which the user verification needs to be performed; and a processorconfigured to: activate the first NFC application, in response to asetting operation of a user, to set the first NFC application as adefault NFC application of the electronic device; and in response to apreset shortcut operation of the user, deactivate the first NFCapplication, and automatically activate the second NFC application toset the second NFC application as the default NFC application.
 10. Anautomatic routing method for a near field communication (NFC)application secure element (SE) applied to an electronic device, whereinthe electronic device comprises at least two secure elements (SEs),wherein each of the at least two SEs carries at least one NFCapplication, and configured to store first identifiers and first SElocation information of a plurality of NFC applications and wherein theautomatic routing method comprises: receiving a transaction instruction;searching, in response to the transaction instruction carrying a secondidentifier from among the first identifiers, second SE locationinformation, from the first SE location information, corresponding tothe second identifier; and determining a first target SE from the atleast two SEs based on the second SE location information, wherein anNFC application in the first target SE executes the transactioninstruction.
 11. The automatic routing method of claim 10, furthercomprising: determining, based on the identifier, a first target NFCapplication from NFC applications carried in the first target SE; andrunning the first target NFC application using the first target SE toexecute the transaction instruction.
 12. The automatic routing method ofclaim 10, wherein the first identifier is an application identifier(AID).
 13. The automatic routing method of claim 10, wherein an NFCmanagement application of the first target NFC application is configuredto manage the NFC applications, and carries a third identifier of thefirst target NFC application and third SE location information of thefirst target NFC application, wherein the third SE location informationindicates the first target SE that carries the first target NFCapplication, and wherein the automatic routing method further comprises:obtaining the third identifier and the third SE location informationthat are transmitted when the NFC management application registers witha default payment application of the electronic device; and storing thethird identifier and the third SE location information.
 14. Theautomatic routing method according to claim 10, wherein the electronicdevice is further configured to store use scenario information, fourthSE location information, and a fourth identifier of a non-standard NFCapplication, wherein the non-standard NFC application does not supportthe AID, wherein the fourth identifier identifies the non-standard NFCapplication and is not the second identifier, and wherein the usescenario information indicate scenario information of a correspondingnon-standard NFC application, and wherein the automatic routing methodfurther comprises: obtaining current scenario information of theelectronic device in response to that the transaction instruction doesnot carry the second identifier; searching the use scenario informationcorresponding to the current scenario information; determining thefourth identifier and the fourth SE location information that correspondto the use scenario information; determining a second target SE from theat least two SEs based on the fourth SE location information;determining, based on the fourth identifier, a second target NFCapplication from NFC applications carried in the second target SE; andrunning the second target NFC application using the second target SE toexecute the transaction instruction.
 15. The automatic routing methodaccording to claim 14, wherein the electronic device is furtherconfigured to store a routing table comprising the first identifiers,the first SE location information, and a non-standard card default item,wherein the non-standard card default item points to an SE correspondingto the current scenario information when the transaction instructiondoes not carry the first identifier, and wherein the automatic routingmethod further comprises configuring the non-standard card default itemto point to the second target SE.
 16. The automatic routing method ofclaim 14, wherein the scenario information comprises at least one ormore of: geographical location information indicating a geographicallocation at which the corresponding non-standard NFC application can beused; time information indicating a time for which the correspondingnon-standard NFC application can be used; and operation informationindicating an operation performed by a user on the electronic devicebefore the corresponding non-standard NFC application is used.
 17. Theautomatic routing method of claim 10, wherein a first SE in the at leasttwo SEs carries a first NFC application and a second NFC application,wherein a first NFC service verification manner supported by the firstNFC application is a direct card swiping mode in which user verificationdoes not need to be performed, wherein a second NFC service verificationmanner supported by the second NFC application is averification-required mode in which the user verification needs to beperformed, wherein the user verification comprises passwordverification, fingerprint verification, face verification, irisauthentication, voiceprint authentication, or behavior authentication,and wherein the automatic routing method comprises: activating the firstNFC application, in response to a setting operation of the user, to setthe first NFC application as a default NFC application of the electronicdevice; and in response to a preset shortcut operation of the user,deactivating the first NFC application, and automatically activating thesecond NFC application to set the second NFC application as the defaultNFC application. 18.-24. (canceled)
 25. The electronic device of claim9, wherein the user verification comprises password verification orfingerprint verification.
 26. The electronic device of claim 9, whereinthe user verification comprises face verification or irisauthentication.
 27. The electronic device of claim 9, wherein the userverification comprises voiceprint authentication or behaviorauthentication.